home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 May / CHIP Mayıs 1997.iso / cont / web / winsock / netxray / data.1 / hi2excel.bas < prev    next >
Encoding:
BASIC Source File  |  1995-12-06  |  1.2 KB  |  43 lines

  1. Sub Main()
  2.     'for NetXRay objs
  3.     Dim netxApp As Object
  4.     Dim historyObj As Object
  5.     Dim histDataObjs As Object
  6.     'for Excel objs
  7.     Dim excelApp as Object
  8.     Dim wb as Object
  9.     Dim ws as Object
  10.  
  11.     Msg = "Please make sure there is at least 1 history window is opened!"
  12.     DlgDef = MB_OKCANCEL + MB_ICONEXCLAMATION
  13.     Title = "NetXRay"
  14.     Response = MsgBox(Msg, dlgDef, Title)
  15.     If Response = IDCANCEL Then
  16.         GoTo ByeBye
  17.     End If
  18.  
  19.     'create NetXRay objs
  20.     Set netxApp = CreateObject("NetXRay.Application.1")
  21.     Set historyObj = netxApp.GetFirstHistory()
  22.     Set histDataObjs = historyObj.GetDataObjects()
  23.  
  24.     'create Excel objs
  25.     Set excelApp = CreateObject("Excel.Application")
  26.     excelApp.Visible = TRUE
  27.     Set wb = excelApp.Workbooks.Add
  28.     Set ws = excelApp.Worksheets(1)
  29.     ws.Columns("A").NumberFormat = "mm/dd/yy hh::mm:ss AM/PM"
  30.     ws.Columns("A").ColumnWidth = 30
  31.  
  32.     n = histDataObjs.Count
  33.     For i = 1 To n
  34.         'MsgBox "Time(" & i & ") = " & histDataObjs.Item(i).GetTimeStr()
  35.         'MsgBox "Data(" & i & ") = " & histDataObjs.Item(i).GetData()
  36.         ws.Cells(i, 1).Value = histDataObjs.Item(i).GetTimeStr()
  37.         ws.Cells(i, 2).Value = histDataObjs.Item(i).GetData()
  38.     Next i
  39.  
  40. ByeBye:
  41.     Msg = "Done"
  42. End Sub
  43.